<?php
function getUser($id){
	$sql = "select `id`, `u_name`, `u_surname`, `group_id`, `u_email`, `u_login`, `u_registerdate`, `u_lastvisitdate` from users where id=".$id;
	$res = mysql_query($sql);
	$row = mysql_fetch_assoc($res);
	return $row;
}

function getGroup($gid){
	$sql = "select * from groups where group_id=".$gid;
	$res = mysql_query($sql);
	$row = mysql_fetch_assoc($res);
	return $row;
}

function getGroupsList($fid){
	$sql = "select group_id,group_name from groups where faculty_id=".$fid;
	$res = mysql_query($sql);
	$list = array();
	while ($row = mysql_fetch_assoc($res)) $list[$row["group_id"]]=$row["group_name"];
	return $list;
}

function getFacultiesList(){
	$sql = "select * from faculties";
	$res = mysql_query($sql);
	$list = array();
	while($row = mysql_fetch_assoc($res)) $list[$row["faculty_id"]]=$row["faculty_name"];
	return $list;
}
?>